. /etc/profile
. ~/.bash_profile

cd  ~/project/ulss-data-dispatcher

if [ $# -lt 2 ]
then
	echo "stat.sh timeStr dataType"
	exit 0
fi

curretDateStr=`date +%Y-%m-%d`
timeStr="$1"
dataType="$2"

dateStr=${timeStr:0:10}

logFile=""

if [ "$curretDateStr" = "$dateStr" ]
then
	logFile="log/ulss-data-dispatcher.log"
else
	logFile=`echo "log/ulss-data-dispatcher.log.$timeStr"|awk '{print $1}'`
fi

echo -e "grep \"$timeStr\" $logFile | grep sending |grep $dataType | awk 'BEGIN{sum=0}{sum=sum+$"9"}END{print sum}'"|sh
